package protocol.JT808_2011;

public class Handle808_2011JT0A implements IHandle808_2011JT {

    @Override
    public String handle(JT808_2011Cmd cmd) {
        byte subOrder = cmd.subOrder();

        switch (subOrder){
            case 0x00:
                return handle0A00(cmd);
            default:
                return "808-2011:未匹配的命令字"+(cmd.readOrder()+","+cmd.subOrder());
        }
    }

    private String handle0A00(JT808_2011Cmd cmd) {
        StringBuilder builder = new StringBuilder();
        builder.append("终端->平台:终端RSA公钥");
        builder.append("\r\n");

        builder.append("终端RSA公钥[e,n]中的e:"+cmd.readDWORD());
        builder.append("\r\n");

        builder.append("RSA公钥[e,n]中的n:"+cmd.readBCD(128));
        builder.append("\r\n");

        return builder.toString();
    }
}
